<?php
/**
 * Login.php
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  Auth
 */

/** base class */
require_once 'Madoqua/Form.php';

/** login validator */
require_once 'Madoqua/Validate/Login.php';

/** controller front **/
require_once 'Zend/Controller/Front.php';

/**
 * Auth_Auth_Login
 * 
 * login form, will accept either a username/password, or an openid
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  Auth
 */
class Auth_Auth_Login extends Madoqua_Form
{
    /**
     * constructor
     * 
     * @param array $options
     */
    public function __construct($options = array())
    {
        parent::__construct();

        $this->setRouteAction(array(), 'login', true);
        //set the action, necessary for safari (and just... proper)
                
        $this->addElement('text', 'username', array(
            'required' => true,
            'label' => 'Username',
            'validators' => array(
                new Madoqua_Validate_Login($options),
                array('StringLength', 155)
            )
        ));
        
        $this->addElement('password', 'password', array(
            'required' => true,
            'label' => 'Password'
        ));
        
        $this->addElement('submit', 'submit', array(
            'label' => 'Login'
        ));

    }
}